package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ReportMapper {

    // 根据订单状态和日期统计查询营业额
    Double sumOrderAmountByStatusAndDate(Integer status, LocalDate date);

    // 统计用户数
    Integer countUserByDate(LocalDate date);

    // 根据订单状态和日期统计订单数
    Integer countOrderByStatusAndDate(Integer status, LocalDate date);

    // 查询商品销售top10
    List<GoodsSalesDTO> selectGoodsSalesTop10(LocalDate begin, LocalDate end);


    //根据套餐表或者菜品表和状态查询起售停售数量
    @Select("select count(*) from ${table} where status=#{status}")
    Integer countByStatusAndTable(String table, Integer status);

}
